#define  _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<string.h>
#include<assert.h>

char* my_strncpy(char* dest, const char* src,size_t num)
{
	assert(dest && src);
	char* str = dest;
	while (*dest++ = *src++&&--num)
	{
		;
	}
	for (int i = 0; i < --num; i++)
	{
		*dest++ = '\0';
	}
	 return str;
}



int main()

{
	char str1[] = "abcd";
	char str2[20] = "xxxxxxx";
	char*s=strncpy(str2, str1,5);
	printf("%s", s);
	return 0;
}